import { ref } from 'vue'
import { defineStore } from 'pinia'
import { getHeadNav } from '@/apis/layout'

export const useCategoryStore = defineStore('category', () => {

  // 保存分类导航栏数据
  const categoryList = ref([])
  // 获取分类导航栏数据
  const getCategoryData = async () => {
    const res = await getHeadNav()
    categoryList.value = res.data.result
  }

  return {
    categoryList,
    getCategoryData
  }
})
